import React from 'react';
import { render } from 'react-dom';
import { Router, Route, IndexRoute } from 'react-router';

import history from '../common/history.es6';
import Layout from '../common/layout.jsx'

import MainView from './MainView.jsx'
import UserListView from './UserListView.jsx'
import RootView from './RootView.jsx'
import TraceView from './TraceView.jsx'
require('./style.less')

render((
  <Router history={ history }>
    <Route path="/" component={MainView}>
      <IndexRoute component={UserListView} />
      <Route path="user/:userIdentifier" component={UserListView} />
      <Route path="imsi/:userIdentifier/:deviceId(/:tab)" component={RootView} />
      <Route path="trace/:traceType/:appVersionId/:deviceId/:userIdentifier" component={TraceView} />
      <Route path="trace/:traceType/:appVersionId/:deviceId/:userIdentifier/:param1" component={TraceView} />
      <Route path="trace/:traceType/:appVersionId/:deviceId/:userIdentifier/:dataType" component={TraceView} />
      <Route path="trace/:traceType/:appVersionId/:deviceId/:userIdentifier/:dataType/:param1/:param2" component={TraceView} />
    </Route>
  </Router>
), document.getElementById('root'));
